import { localCache } from "@/utils/cache"
import { BASE_URL, TIME_OUT } from "./config"
import Request from "./request"

const request = new Request({
  baseURL: BASE_URL,
  timeout: TIME_OUT,
  interceptors: {
    requestSuccessFn: (config) => {
      // 每一个请求都自动携带token
      const token = localCache.getCache("token")
      config.url = `/fx${config.url}`
      config.auth = `222`

      return config
    },
  },
})

export default request
